*************
**// Panel A
*************
** // Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
**//unweighted
ivreg2 PCC, cluster (IDStudy)
**//weighted 
ivreg2 PCC [pweight=investperst], cluster (IDStudy)

**// Extension
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Four\Extra_papers.dta"
set more off
**//unweighted
ivreg2 PCC, cluster (IDStudy)
**//weighted 
ivreg2 PCC [pweight=investperst], cluster (IDStudy)



*************
**// Panel B
*************
**// Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)

**// Extension
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Four\Extra_papers.dta"
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)


*************
**// Panel C
*************
**// Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
xtset IDStudy
gen double lnobs = ln(Samplesize)
**// weighted
ivreg2 PCC SEPCC dummies Hstatistic developed undeveloped Logit lnobs ///
citations firstpub quadratic Boone IFrecursive regulation OLS ///
reviewed_journal [pweight=investperst], cluster (IDStudy)

lincom  _cons + SEPCC*0 + lnobs*11.3 + IFrecursive*0.744 + ///
citations*4.164078 +firstpub*6.677419 + reviewed_journal*1 + ///
dummies*0 +  Hstatistic*0 + developed*0.3663594 + undeveloped*0.375576 + ///
Logit*0 + regulation*1 + quadratic*0 + Boone*1 + OLS*0

**// unweighted
ivreg2 PCC SEPCC  dummies Hstatistic developed undeveloped FE ///
lnobs ownership Logit SLS firstpub citations profitability ///
IFrecursive, cluster (IDStudy)

lincom _cons+SEPCC*0+dummies*0+Hstatistic*0+developed*0.3663594+ ///
undeveloped*0.375576+SLS*0.1488294+Logit*0+FE*0.229097+lnobs*11.3+ ///
IFrecursive*0.744+citations*4.164078+firstpub*6.453177+ ///
ownership*0.1655518+profitability*0.0434783

**// Extension
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Four\Extra_papers.dta"
set more off
gen double lnobs = ln(Samplesize)
xtset IDStudy
**// weighted
ivreg2 PCC citations firstpub OLS reviewed_journal Concentration Logit  macro ///
HHI FE RE developed T Zscore global dummies  sampleyear undeveloped [pweight=investperst], cluster (IDStudy) 

lincom  _cons + citations*2.639057+firstpub*10.42857 + reviewed_journal*1+ ///
OLS*0+ Concentration*0 + Logit*0+  macro*0.1428572 + HHI*0+ FE*0.2669671+ ///
RE*0.0806259+  developed*0.3238096  +  T*2.352176+  Zscore*0.3350795+  ///
global*0.7401947 + dummies*0 + sampleyear*10.50945 + undeveloped*0.3433163 
**//unweighted
ivreg2 PCC Boone NPL sampleyear  HHI DtoD IFrecursive developed undeveloped, cluster (IDStudy)

lincom _cons+ Boone*1+ NPL*0.160105+ sampleyear*9.644357+  HHI*0 + ///
DtoD*1 + IFrecursive*0.486 +developed*0.4370079+ undeveloped*0.2427822
